Header

Förkortningar

  • UA - User Agent

Statuskod från HTTP

  • 431Request Header Fields Too Large
http

Plats

Delar

Note: Lax replaced None as the default value in order to ensure that users have reasonably robust defense against some classes of cross-site request forgery (CSRF) attacks.
Cache www.website.com

Fråga

Cache Specials (Unicode block) http://www.

Svar

Förkortningar

Header för Basic authentication (BA) i PHP

header('WWW-Authenticate: Basic realm="My Realm"');

Variabler för Basic authentication (BA) i PHP

$_SERVER['PHP_AUTH_USER'] $_SERVER['PHP_AUTH_PW']

Skicka headers med UNIX

curl --header "X-MyHeader: 123" example.com

Kod för att välja HTTP-header i AJAX med JavaScript

xhr.open('HEAD', 'example.com', true);

Visa headers som objekt med AJAX i JavaScript

function smart_split(cntn, first, second) { arr = cntn.split(first); obj = {}; arr.forEach(function (line) { parts = line.split(second); header = parts.shift(); value = parts.join(second); obj[header] = value; }); return obj; } xhr = new XMLHttpRequest(); xhr.open('GET', window.location, true); xhr.onloadend = function() { headers = smart_split(xhr.getAllResponseHeaders().trim(), /[\r\n]+/, ': '); type = smart_split('mime-type=' + headers['content-type'], '; ', '='); } xhr.send();

Hämta headers med AJAX i JavaScript

xhr = new XMLHttpRequest(); xhr.setRequestHeader('custom-header', 'value'); xhr.open('GET', '/folder/file.extension?query=1&q=2', true); xhr.onloadend = function() { console.log(xhr.status); console.log(xhr.statusText); console.log(xhr.getAllResponseHeaders()); } xhr.send();

Hämta headers för webbläsare med PHP

getallheaders()

Hämta headers för server med PHP

headers_list() apache_request_headers()

Hämta headers från URL med PHP

get_headers('http://example.com', 1)

Returnera en header med PHP

http_response_code(404);

PHP

headers_sent()

URL

header('Location: http://www.example.com/');

HTML och Unicode

header('Content-Type: text/html; charset=utf-8');

Not found

header("HTTP/1.0 404 Not Found");

CSS

header('Content-Type: text/css');

Javascript

header('Content-Type: application/javascript'); header('Content-Type: text/javascript');

JPEG Image

header('Content-Type: image/jpeg');

JSON

header('Content-Type: application/json'); header('Content-Type: application/ubjson');

PDF

header('Content-Type: application/pdf');

RSS

header('Content-Type: application/rss+xml; charset=ISO-8859-1');

Text (Plain)

header('Content-Type: text/plain');

XML

header('Content-Type: text/xml');

CSV

header('Content-Type: text/csv'); header('Content-Type: text/tsv');

PNG

header('Content-Type: image/png');

Refused to execute a JavaScript script. Source code of script found within request

The XSS Auditor refused to execute a script in * because its source code was found within the request. The auditor was enabled because the server did not send an 'X-XSS-Protection' header.
header('X-XSS-Protection: 0'); Postman logotyp cURL logotyp

Program

Programmeringsspråk

http

Protokoll

Säkerhet för API

  • Basic
  • Bearer
  • Digest
Konsolens nätverks-flik

Externa länkar